#pragma once
#include "SplitTool.h"
class SplitToolUTF8
:public SplitTool
{
public:
    SplitToolUTF8(){};

    // 最小編輯距離算法
    vector<string> cut(const string & str) override{
        vector<string> word;
        for(int i=0; i<str.size();){
            int strlen = 1;
            if((str[i] & 0xf8) == 0xf0){
                strlen = 4;
            } else if ((str[i] & 0xf0) == 0xe0){
                strlen = 3;
            } else if ((str[i] & 0xe0) == 0xc0){
                strlen = 2;
            } else if ((str[i] & 0x80) == 0x00){
                strlen = 1;
            }
            word.push_back(str.substr(i, strlen));
            i += strlen;
        }
        return word;
    }
private:

};